package com.huluobo.a2202mvvm_im_douyindemo.chat;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.huluobo.a2202mvvm_im_douyindemo.R;
import com.hyphenate.easeui.modules.chat.EaseChatFragment;

public class ChatActivity extends AppCompatActivity {
    private ChatFragment chatFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chat);

        TextView title = findViewById(R.id.header_title_tv);
        String username = getIntent().getStringExtra("conversationId");
        title.setText(username);

        ImageView back = findViewById(R.id.header_back_iv);
        back.setVisibility(View.VISIBLE);
        back.setOnClickListener(v -> finish());

        //use EaseChatFratFragment
        chatFragment = new ChatFragment();
        //pass parameters to chat fragment
        chatFragment.setArguments(getIntent().getExtras());
        getSupportFragmentManager().beginTransaction().add(R.id.container, chatFragment).commit();
    }
}